﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UpdateApp
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            var ready = Windows_Update.ProcessCheck();

            if (ready)
            {
                string cmd = "";
                if (args.Length > 0)
                {
                    cmd = args[0];
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (cmd == "/s")
                {
                    var ret = UpdateTool.Check();
                    if (ret != 0)
                    {
                        Application.Run(new Windows_Update());
                    }
                }
                else
                {
                    Application.Run(new Windows_Update());
                }
            }
            else
            {
                Application.Exit();
            }
        }
    }
}
